package it.univaq.mwt.model.entity;

import java.io.Serializable;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;

@Entity
@NamedQueries({ 
	@NamedQuery(name="getNewsById",query="SELECT n FROM News n  WHERE n.id=:id_news"),
	@NamedQuery(name="getNewsList",query="SELECT n FROM News n ORDER BY n.id ASC"),	
	@NamedQuery(name="searchNumNews",query="SELECT COUNT(n) FROM News n"),
	@NamedQuery(name="getNewsListSmall",query="SELECT n FROM News n WHERE ROWNUM <=:limit")
})
@SequenceGenerator(name="sequence",sequenceName="MASTER.NEWS_SEQ")
public class News implements Serializable {

	@Id
	@GeneratedValue(generator="sequence")
    
	@Column(name="id",nullable=false,length=11)
	private int id;
	
	@Column(name="link",nullable=false,length=100)
	private String link;
	
	@Column(name="creation_date",nullable=false)
	private Date creation_date;

	@Lob
	@Column(name="description",nullable=false)
	private String description;
	
	@Column(name="title",nullable=false)
	private String title;
	
	
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public Date getCreation_date() {
		return creation_date;
	}

	public void setCreation_date(Date creation_date) {
		this.creation_date = creation_date;
	}

	
	
	
	
}
